home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Localization / Verifier 1.0 / v.getDefaultStrings < prev    next >
Encoding:
Text File  |  1994-02-09  |  6.9 KB  |  203 lines  |  [TEXT/MPS ]

  1. #
  2. #        getDefaultStrings
  3. #
  4. #        Apple Computer, Inc. 1993
  5. #        By Kerry Laidlaw    2/1/93
  6. #
  7. #        This script will open the "V.DefaultStrings" data file and set
  8. #        shell variables to these string values for use in other scripts.
  9. #
  10.  
  11. #    Save some initial shell variable values, and set them for our own use
  12.  
  13.     set saveExit    {exit}
  14.     set exit    0        # Set exit 0 so we won't abort if status variable is non-zero
  15.     set saveEcho {echo}    # echo=1 for echoing each command before execution
  16.     set echo 0
  17.     set saveDir `directory`
  18.  
  19. if ("{1}" == "setDefaults")    ||    ("{1}" == "doVerify") ||    ("{1}" == "getDefaults")
  20.     alias > "{mpw}v.TempFile"        # Save the current Aliases
  21.     unalias                            # Delete them because we need to have own set for commando
  22. #    execute v.countryCodes    #    Establish list of alias' for the countrys
  23.     
  24.         # Country code that is needed for identifying software origin.
  25.         # With new countries just added them in the same format.
  26.  
  27.         #alias '  0/*  - USA'                     0                            
  28.         alias '  1/F  - France'                 1
  29.         alias '  2/B  - Britain'                 2
  30.         alias '  3/D  - Germany'                 3
  31.         alias '  4/T  - Italy'                     4
  32.         alias '  5/N  - Netherlands'             5
  33.         alias '  6/FN - Belgium Lux.'             6
  34.         alias '  7/S  - Sweden'                 7
  35.         alias '  8/E  - Spain'                     8
  36.         alias '  9/DK - Denmark'                 9
  37.         alias ' 10/PO - Portugal'                 10
  38.         alias ' 11/C  - Fr. Canadian'             11
  39.         alias ' 12/H  - Norway'                 12
  40.         alias ' 13/HB - Israel'                 13
  41.         alias ' 14/J  - Japan'                     14
  42.         alias ' 15/X  - Australia'                 15
  43.         alias ' 16/AB - Arabia'                 16
  44.         alias ' 17/K  - Finland'                 17
  45.         alias ' 18/SF - Fr. Swiss'                 18
  46.         alias ' 19/SD - Gr. Swiss'                 19
  47.         alias ' 20/GR - Greece'                 20
  48.         alias ' 21/IS - Iceland'                 21
  49.         alias ' 22/MA - Malta'                     22
  50.         alias ' 23/CY - Cyprus'                 23
  51.         alias ' 24/TU - Turkey'                 24
  52.         alias ' 25/YU - Yugoslavia'             25
  53.         alias ' 33/HN - India'                     33
  54.         alias ' 34/UR - Pakistan'                 34
  55.         alias ' 36/ST - Italian Swiss'             36
  56.         alias ' 37/Z  - International'             37
  57.         alias ' 39/RO - Romania'                 39
  58.         #alias ' 40/?? - Polytonic'             40
  59.         alias ' 41/LH - Lithuania'                 41
  60.         alias ' 42/PL - Poland'                 42
  61.         alias ' 43/MG - Hungary'                 43
  62.         alias ' 44/ES - Estonia'                 44
  63.         alias ' 45/LT - Latvia'                 45
  64.         #alias ' 46/?? - Lapland'                 46
  65.         alias ' 47/FA - Faeroe Isl.'             47
  66.         alias ' 48/PS - Iran'                     48
  67.         alias ' 49/RS - Russia'                 49
  68.         alias ' 50/GE - Ireland'                 50
  69.         alias ' 51/KH - Korea'                     51
  70.         alias ' 52/CH - China'                     52
  71.         alias ' 53/TA - Taiwan'                 53
  72.         alias ' 54/TH - Thailand'                 54
  73.         alias ' 55/SS - Script System'             55
  74.         alias ' 56/CZ - Czech Republic'             56
  75.         alias ' 57/SL - Slovakia'                 57
  76.         alias ' 58/FE - Far East'                 58
  77.         alias ' 60/?? - Bangladesh'             60
  78.         alias ' 61/BY - Byelorussia'             61
  79.         alias ' 62/UA - Ukrane'                     62
  80.         #alias ' 64/?? - Greece (Alternate)'     64
  81.         alias ' 65/SR - Serbia'                 65
  82.         alias ' 66/SV - Slovenia'                 66
  83.         alias ' 67/MD - Macedonia'                 67
  84.         alias ' 68/CR - Croatia'                 68
  85.         alias ' 71/BR - Brazil'                 71
  86.         alias ' 72/BG - Bulgaria'                 72
  87.         alias ' 73/CA - Catalan'                 73
  88.         alias ' 74/ZM - Intl. Multi-Lingual'     74
  89.         alias ' 75/GA - Scotland,Gaelic'                 75
  90.         alias ' 76/GV - Man,Gaelic'                     76
  91.         alias ' 77/BZ - Breton'                 77
  92.         alias ' 78/IK - Canada/Alaska(Inuktitut)' 78
  93.         alias ' 79/SU - Wales'                     79
  94.         alias ' 81/GS - Ireland(Gaelic)'         81
  95.         alias ' 82/V  - Canada (CanadianEng)'     82
  96.         alias ' 83/BH - Bhutanese'                 83
  97.         alias ' 84/HV - Armenian'                 84
  98.         alias ' 85/KR - Georgian'                 85
  99.         alias ' 86/LA - Latin America'             86        
  100.  
  101.     set            DefaultStringsFile "{mpw}"scripts:V.DefaultStrings
  102.     target    "{DefaultStringsFile}"
  103.     
  104.     #        Select line 1 and assign it to my "UserName" shell variable
  105.         find         1
  106.         set            UserName    "`catenate §`"
  107.         if "{UserName}" == "•No Default•"
  108.             set UserName    "{User}"
  109.         end
  110.         export    UserName
  111.     
  112.     #        Select line 2 and assign it to my "ProductName" shell variable
  113.         find         2
  114.         set            ProductName    "`catenate §`"
  115.         export    ProductName
  116.     
  117.     #        Select line 3 and assign it to my "rNamesFolder" shell variable
  118.         find         3
  119.         set            rNamesFolder    "`catenate §`"
  120.         if (! "`exists -d "{rNamesFolder}"`") && ("{rNamesFolder}" != "•No Default•")
  121.             alert "Could not find rNames folder default:∂n∂n"{rNamesFolder}"∂n∂nThe default has been reset to ∂"•No Default•∂"."
  122.             set            rNamesFolder    "•No Default•"
  123.             replace    3    "{rNamesFolder}"∂n
  124.         end
  125.         export    rNamesFolder
  126.     
  127.     #        Select line 4 and assign it to my "MasterFolder" shell variable
  128.         find         4
  129.         set            MasterFolder    "`catenate §`"
  130.         if (! "`exists -d "{MasterFolder}"`") && ("{MasterFolder}" != "•No Default•")
  131.             alert "Could not find Master folder default:∂n∂n"{MasterFolder}"∂n∂nThe default has been reset to ∂"•No Default•∂"."
  132.             set            MasterFolder    "•No Default•"
  133.             replace    4    "{MasterFolder}"∂n
  134.         end
  135.         export    MasterFolder
  136.     
  137.     #        Select line 5 and assign it to my "TestFolder" shell variable
  138.         find         5
  139.         set            TestFolder    "`catenate §`"
  140.         if (! "`exists -d "{TestFolder}"`") && ("{TestFolder}" != "•No Default•")
  141.             alert "Could not find Test folder default:∂n∂n"{TestFolder}"∂n∂nThe default has been reset to ∂"•No Default•∂"."
  142.             set            TestFolder    "•No Default•"
  143.             replace    5    "{TestFolder}"∂n
  144.         end
  145.         export    TestFolder
  146.     
  147.     #        Select line 6 and assign it to my "ReportFolder" shell variable
  148.         find         6
  149.         set            ReportFolder    "`catenate §`"
  150.         if (! "`exists -d "{ReportFolder}"`") && ("{ReportFolder}" != "•No Default•")
  151.             alert "Could not find Report folder default:∂n∂n"{ReportFolder}"∂n∂nThe default has been reset to ∂"•No Default•∂"."
  152.             set            ReportFolder    "•No Default•"
  153.             replace    6    "{ReportFolder}"∂n
  154.         end
  155.         export    ReportFolder
  156.     
  157.     #        Select line 7 and assign it to my "LangCode" shell variable
  158.         find         7
  159.         set            countryCodeDefault    "`catenate §`"
  160.         export    countryCodeDefault
  161.         (evaluate "{countryCodeDefault}" =~ /?(??)®1≈/) >dev:null
  162.         set LangInt     "{®1}"
  163.         (evaluate "{countryCodeDefault}" =~ /?(≈)®1/) >dev:null
  164.         alias "∂t{®1}" "{LangInt}"    # Set the pop-up default
  165.     
  166.     #        Select line 8 and assign it to my "FileList" shell variable
  167.         find         8
  168.         set            FileList    "`catenate §`"
  169.         if (! "`exists -f "{FileList}"`") && ("{FileList}" != "•No Default•")
  170.             alert "Could not find File List default:∂n∂n"{FileList}"∂n∂nThe default has been reset to ∂"•No Default•∂"."
  171.             set            FileList    "•No Default•"
  172.             replace    8    "{FileList}"∂n    # Write it out to the file
  173.         end
  174.         export    FileList
  175.     
  176.         close -y        # Save the changes to the default file
  177.         if "{1}" == "doVerify"
  178.             execute v.verify…        #     Call the Create Report Commando script
  179.         else if "{1}" == "setDefaults"
  180.             execute v.setDefaultStrings…
  181.         else if "{1}" == "getDefaults"
  182.             set rnamesfolder "`directory -q`"        
  183.             export rnamesfolder        
  184.             execute v.rNames…        #     Call the Create rNames Commando script
  185.         else
  186.             echo "Script failure - v.getDefaultStrings"
  187.             exit 2
  188.         end
  189. else
  190.     unalias
  191.     if `exists "{mpw}"v.TempFile`
  192.         execute "{mpw}"v.TempFile
  193.         delete "{mpw}"v.TempFile > dev:null
  194.     end
  195. end
  196.  
  197.     
  198. #    Restore shell variables and exit
  199.  
  200.     directory    "{saveDir}"            # Leave the directory setting unchanged
  201.     set echo    {saveEcho}             # restore echo
  202.     set exit    "{saveExit}"
  203.